export const OrderStatus = {
  PENDING_PAYMENT: 5, // 待支付
  PENDING_DELIVERY: 10, // 待发货
  DELIVERY: 15, // 配送中
  COMPLETE: 50, // 已完成/待评价
  PENDING_REFOUND: 60, // 待退款

  PENDING_RECEIPT: 40, // 待收货
  PAYMENT_TIMEOUT: 80, // 已取消，支付超时
  CANCELED_NOT_PAYMENT: 80, // 已取消，未支付主动取消
  CANCELED_PAYMENT: 80, // 已取消，已支付主动取消
  CANCELED_REJECTION: 80, // 已取消，拒收
  descRefoundStatus(refoundInfo) {
    const desc = {
      'wait': '申请退款',
      'success': '已退款',
      'cancel': '已取消退款'
    }
    if (!refoundInfo?.status) return ''
    return (refoundInfo.statusDesc = desc[refoundInfo.status])
  },
  getName(status) {
    switch (status) {
      case OrderStatus.PENDING_PAYMENT:
        return '待付款'
      case OrderStatus.PENDING_DELIVERY:
        return '待配送'
      case OrderStatus.DELIVERY:
        return '配送中'
      case OrderStatus.COMPLETE:
        return '已送达'
      default:
        return ''
    }
  }
};

export const orderStatus = OrderStatus

export const orderTagInfos = [{
    title: '待付款',
    iconName: 'wallet',
    orderNum: 0,
    tabType: 5,
    status: OrderStatus.PENDING_PAYMENT,
  },
  {
    title: '待配送',
    iconName: 'store',
    orderNum: 0,
    tabType: 0,
    status: OrderStatus.PENDING_DELIVERY,
  },
  {
    title: '配送中',
    iconName: 'deliver',
    orderNum: 0,
    tabType: 10,
    status: OrderStatus.DELIVERY,
  },
  {
    title: '已送达',
    iconName: 'package',
    orderNum: 0,
    tabType: 40,
    status: OrderStatus.COMPLETE,
  },
  // {
  //   title: '水票',
  //   iconName: 'discount',
  //   orderNum: 0,
  //   tabType: 50,
  //   status: -2,
  //   split: true
  // },
  // {
  //   title: '待评价',
  //   iconName: 'comment',
  //   orderNum: 0,
  //   tabType: 60,
  //   status: 1,
  // },
  // {
  //   title: '退款/售后',
  //   iconName: 'exchang',
  //   orderNum: 0,
  //   tabType: 0,
  //   status: 1,
  // },
];

// 售后状态 10:待审核,20:已审核,30:已收货,40:收货异常,50:已完成,60:已关闭;
export const AfterServiceStatus = {
  TO_AUDIT: 10, // 待审核
  THE_APPROVED: 20, // 已审核
  HAVE_THE_GOODS: 30, // 已收货
  ABNORMAL_RECEIVING: 40, // 收货异常
  COMPLETE: 50, // 已完成
  CLOSED: 60, // 已关闭
};

// 售后类型
export const ServiceType = {
  RETURN_GOODS: 10, // 退货退款
  ONLY_REFUND: 20, // 仅退款
  ORDER_CANCEL: 30, // 支付后取消
};

export const ServiceTypeDesc = {
  [ServiceType.RETURN_GOODS]: '退货',
  [ServiceType.ONLY_REFUND]: '退款',
  [ServiceType.ORDER_CANCEL]: '支付后取消',
};

// 订单按钮类型
export const OrderButtonTypes = {
  PAY: 1, // 付款
  CANCEL: 2, // 取消订单
  CONFIRM: 3, // 确认收货
  APPLY_REFUND: 4, // 申请售后
  VIEW_REFUND: 5, // 查看退款
  COMMENT: 6, // 评价
  DELETE: 7, // 删除订单
  DELIVERY: 8, // 查看物流
  REBUY: 9, // 再次购买
  INVITE_GROUPON: 11, //邀请好友拼团
};

// 售后服务按钮类型
export const ServiceButtonTypes = {
  REVOKE: 2, // 撤销
  FILL_TRACKING_NO: 3, // 填写运单号
  CHANGE_TRACKING_NO: 4, // 修改运单号
  VIEW_DELIVERY: 5, // 查看物流
};

// 售后状态
export const ServiceStatus = {
  PENDING_VERIFY: 100, //待审核
  VERIFIED: 110, // 已审核待寄回商品
  PENDING_DELIVERY: 120, // 等待买家寄回商品
  PENDING_RECEIPT: 130, // 已寄回商品，待收货
  RECEIVED: 140, // 已收货
  EXCEPTION: 150, // 收货异常
  REFUNDED: 160, // 已退款
  CLOSED: 170, // 已关闭
};

// 售后收货状态
export const ServiceReceiptStatus = {
  RECEIPTED: 1, // 已收到货
  NOT_RECEIPTED: 2, // 未收到货
};

// 物流节点
export const LogisticsNodeTypes = {
  SUBMITTED: 200001, // 已提交订单
  PAYMENTED: 200002, // 已付款/已下单
  SHIPPED: 200003, // 已发货
  CANCELED: 200004, // 已取消
  RECEIVED: 200005, // 已签收
  ADDRESS_CHANGED: 200006, // 已修改地址
  IN_TRANSIT: 200007, // 运输中
};

export const LogisticsIconMap = {
  [LogisticsNodeTypes.SUBMITTED]: '',
  [LogisticsNodeTypes.PAYMENTED]: 'credit_card',
  [LogisticsNodeTypes.SHIPPED]: 'deliver',
  [LogisticsNodeTypes.CANCELED]: '',
  [LogisticsNodeTypes.RECEIVED]: 'check',
  [LogisticsNodeTypes.ADDRESS_CHANGED]: '',
  [LogisticsNodeTypes.IN_TRANSIT]: 'yunshuzhong',
};